import React from 'react';
import { Button } from 'antd';
import { WeaDialog ,WeaLocaleProvider} from 'ecCom';
import { observer } from 'mobx-react';
const getLabel = WeaLocaleProvider.getLabel;
import "./index.less";
import NewTaskSetting from './NewTaskSetting';
@observer
export default class NewTaskDialog extends React.Component {
    render() {
        const { store } = this.props;
        const { app, visible, onCancel, submiting, form, onSave,showDesigner } = store.newTaskDialog;
        const buttons = [
            <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@otxygx@onOk`} type='primary' icon={submiting && 'loading'} disabled={submiting} onClick={onSave}>{getLabel('826', '确定')}</Button>,
            <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@lh9p1u@cancel`} type='ghost' onClick={onCancel}>{getLabel(31129,'取消')}</Button>
        ];
        return (
            <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@b9r1ez`}
                title={`${getLabel('502751','发起任务')+":"+app.name}`}
                icon={"icon-coms02-Data-center"}
                iconBgcolor="#1a57a0"
                style={{ width: 1100, height: 600 }}
                visible={visible}
                buttons={buttons}
                onCancel={onCancel}
            >
                {/* {app.pathid == "" && (<div><div className="wea-notice-tip"><i className="icon-coms-Explain" />
                <span className="wea-notice-content"> 未设置路径，<a onClick = {()=> showDesigner(app)}>设置</a></span></div></div>)} */}
                <NewTaskSetting ecId={`${this && this.props && this.props.ecId || ''}_NewTaskSetting@s5m427`} params={{ appid: app.id }} store={store}></NewTaskSetting>
            </WeaDialog>
        )
    }

    // 周期数值发生变化时触发回调
    onChange(data) {
        var cycle = data["cycle"];
        if(cycle !== undefined) {
            const { store } = this.props;
            const {baseDateHide} = store;
            var value = cycle.value;
            store.updateCondition(false,value);
            // if(baseDateHide == true && value > 0) {
            //     store.updateCondition(false,value);
            // } else if(baseDateHide == false && value == 0) {
            //     store.updateCondition(true,value);
            // }
            
        }
      
    }
}